#ifndef __BSF_INTERFACE_H__
#define __BSF_INTERFACE_H__
#include "LT8920.H"
#include "timer.h"
#include "LT8920.h"
#include "DataFlash.h"
#define MAXBUF 63
#define MAX_CHANNEL_NUM 8


extern unsigned char code channelTable[MAX_CHANNEL_NUM];

typedef  bit BSF_BIT;
//use for send pkt,
#define bsf_itf_send(buf,datLen)      LT8920_TXPKT(buf,datLen)
//use for recv pkt
//buf: the address of sending buf,
//buflen: the buf length.
//ret: real RecvLength
#define bsf_itf_recv(buf,bufLen)      LT8920_RXPKT(buf,bufLen)

#define bsf_itf_isSendBusy()          LT8920_isTxBusy()

#define bsf_itf_isSendOk()            LT8920_isTxOk()

#define bsf_itf_isRecvArrival()       LT8920_isRxArrival()

#define bsf_itf_setChn(x)             LT8920_SetChn(x)

#define bsf_itf_getTimestamp_100us()  timer_getStamp_100us()
#define bsf_itf_getTimestamp()        timer_getStamp()       

void bsf_itf_save(UINT8 addr,PUINT8 buf,UINT8 buflen);
//#define bsf_itf_save(addr,buf,buflen) WriteDataFlash(addr,buf,buflen)
#define bsf_itf_read(addr,len,buf)    ReadDataFlash(addr,len,buf)      

#define bsf_itf_setToRx()             LT8920_SetToRx()

#define bsf_itf_setSync(x)         LT8920_SetSyncword(x)
#define bsf_itf_setSyncDefault()   LT8920_SetSyncwordDefault()
#define bsf_itf_reset()               LT8920_init()

void bsf_timerPerMsDo();
#endif